<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>index.js</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" href="../../../../../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../../../../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../../../../css/github.css" type="text/css" media="screen" />
<script src="../../../../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../../../js/main.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../../../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>

</head>

<body>
    <div class="banner">
        
        <h1>
            index.js
        </h1>
        <ul class="files">
            
            <li>
                lib/assets/javascripts/sale_app/store_orders/index.js
                
            </li>
            <li>Last modified: 2017-02-11 20:21:44 +0800</li>
        </ul>
    </div>

    <div id="bodyContent">
        <div id="content">
  
    <div class="description">
      
<p>jQuery(function($){</p>

<pre><code>setDateTimePicker()
// show my order
$(&quot;a.js-my-order-numero&quot;).on(&quot;click&quot;, function(e){
  e.preventDefault();
  var orderItemTemp = JST[&quot;sales/store_orders/item_product&quot;]
  var id = $(this).data(&quot;id&quot;);
  $.ajax({
    url: &quot;/api/store_orders/&quot;+ id,
    success: function(data){
      if(data.status){
        console.log(data.items);

        BootstrapDialog.show({
          title: &quot;订单详情&quot;,
          message: orderItemTemp({items: data.items, remark: data.remark, store_id: getUrlParam(&#39;store_id&#39;)}),
          buttons: [{
              label: &#39;确定&#39;,
              cssClass: &#39;btn-primary&#39;,
              action: function(dialogRef){
                  dialogRef.close();
              }
          }]
        });

      }else {
        showErrorView(&quot;服务器出错！&quot;)
      }
    }
  })

})

// 点击取消我的订单
$(&quot;a.js-to-cancel-my-order&quot;).on(&quot;click&quot;, function(){
  var _this = this
  BootstrapDialog.confirm(&#39;确定取消该订单吗？&#39;, function(result){
          if(result) {
            var id = $(_this).data(&quot;id&quot;);
            var csrf = $(&quot;input#js-sale-my-orders-index&quot;).val();
              $.ajax({
                url: &quot;/api/store_orders/&quot;+ id +&quot;/cancel&quot;,
                method: &#39;put&#39;,
                headers: {
                  &#39;X-CSRF-Token&#39;: csrf
                },
                success: function(data){
                  if (data.status){
                    $(&quot;span.js-my-order-status-&quot;+id).text(&quot;已取消&quot;);
                    $(_this).replaceWith(&quot;&lt;span&gt;取消&lt;/span&gt;&quot;)
                  }
                }
              })
          }else {

          }
      });
})</code></pre>

<p>})</p>

    </div>
  


  


  
  


  


  

  



  

    

    

    


    


    <!-- Methods -->
              </div>

    </div>
  </body>
</html>
